/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package com.lineage.server.model.item.etcitem.action;

import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.item.ItemExecutor;
import com.lineage.server.packetserver.S_ServerMessage;

/**
 * Class <code>ScrollOfDestroyArmor</code> 毁灭盔甲的卷轴 - 40075.
 * 
 * @author jrwz
 * @version 2012-6-19下午03:58:17
 * @see com.lineage.server.model.item.etcitem.action
 * @since JDK1.7
 */
public final class ScrollOfDestroyArmor extends ItemExecutor {

    /**
     * 取得实例.
     * 
     * @return 实例
     */
    public static ItemExecutor get() {
        return new ScrollOfDestroyArmor();
    }

    /** 毁灭盔甲的卷轴 - 40075. */
    private ScrollOfDestroyArmor() {
    }

    @Override
    public void execute(final L1PcInstance pc, final L1ItemInstance useItem,
            final int readC1, final int readC2, final int targetId,
            final int targetX, final int targetY) {
        final int targetID = targetId;
        final L1ItemInstance l1iteminstance1 = pc.getInventory().getItem(
                targetID);

        if (l1iteminstance1.getItem().getType2() == 2) {
            int msg = 0;
            switch (l1iteminstance1.getItem().getType()) {
                case 1: // helm
                    msg = 171; // \f1你的钢盔如爆炸般地破碎了。
                    break;
                case 2: // armor
                    msg = 169; // \f1你的盔甲变成尘埃落地。
                    break;
                case 3: // T
                    msg = 170; // \f1你的T恤破碎成线四散。
                    break;
                case 4: // cloak
                    msg = 168; // \f1你的斗蓬破碎化为尘埃。
                    break;
                case 5: // glove
                    msg = 172; // \f1你的手套消失。
                    break;
                case 6: // boots
                    msg = 173; // \f1你的长靴分解。
                    break;
                case 7: // shield
                    msg = 174; // \f1你的盾崩溃分散。
                    break;
                default:
                    msg = 167; // \f1你的皮肤痒。
                    break;
            }
            pc.sendPackets(new S_ServerMessage(msg));
            pc.getInventory().removeItem(l1iteminstance1, 1);
        } else {
            pc.sendPackets(new S_ServerMessage(154)); // \f1这个卷轴散开了。
        }
        pc.getInventory().removeItem(useItem, 1);
    }
}
